package com.atnjupt.service.impl;

import com.atnjupt.bean.User;
import com.atnjupt.dao.impl.UserDaoImpl;
import com.atnjupt.service.UserService;

/**
 * @author Wizarder
 * @create 2021-05-27 17:47
 */
public class UserServiceImpl implements UserService {
    UserDaoImpl udi = new UserDaoImpl();
    @Override
    public void registUser(User user) {
        udi.SaveUser(user);
    }

    @Override
    public User login(User user) {
        User user1 = udi.queryForUsernameAndPassword(user.getUsername(), user.getPassword());
        return user1;
    }

    @Override
    public boolean existUsername(String name) {
        User user = udi.querForUsername(name);
        if(user == null){
            return false;
        }else{
            return true;
        }
    }
}
